package com.hotelvip.vo;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.hotelvip.common.utils.EnumUtil;
import com.hotelvip.entity.Item;
import com.hotelvip.entity.ItemCat;
import com.hotelvip.enumEntity.ItemStatueEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.List;

/**
 * 商品vo对象
 * @author Lzh
 * @date 2020/12/16 11:11
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@Accessors(chain = true)
@ApiModel(value = "商品vo对象",description = "商品vo对象ItemVo")
public class ItemVo {
    @ApiModelProperty(value = "商品对象",name = "item")
    private Item item;
    @ApiModelProperty(value = "可置换商品列表对象",name = "turnItem")
    private List<Item> turnItem;
    @ApiModelProperty(value = "商品状态",name = "statusText")
    private String statusText;
    @ApiModelProperty(value = "所属分类",name = "itemCat")
    private ItemCat itemCat;

    public String getStatusText(){
        if (item.getStatus()==null || EnumUtil.getByindex(item.getStatus(), ItemStatueEnum.class)==null)
            return "";
        return EnumUtil.getByindex(item.getStatus(), ItemStatueEnum.class).getName();
    }


}
